From: Marco Trevisan (TreviƱo) Date: Fri, 30 Aug 2019 23:32:03 +0000 (+0200) Subject: avatar: Use Property bindings to sync reactivity X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~781^2^2~520 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=db7726c5bf4e2ae557163cf2db7aaadf90762837;p=gnome-shell.git avatar: Use Property bindings to sync reactivity Instead of manually updating properties on change, use native properties bindings to keep the them synchronized. Disable hover-tracking and focus-ability when the avatar is not sensitive. https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/559 --- diff --git a/js/ui/userWidget.js b/js/ui/userWidget.js index 5cd4bb36d..9dcc60f40 100644 --- a/js/ui/userWidget.js +++ b/js/ui/userWidget.js @@ -25,7 +25,6 @@ var Avatar = GObject.registerClass({ super._init({ style_class: params.styleClass, - track_hover: params.reactive, reactive: params.reactive, width: params.iconSize * themeContext.scaleFactor, height: params.iconSize * themeContext.scaleFactor @@ -34,6 +33,11 @@ var Avatar = GObject.registerClass({ this._iconSize = params.iconSize; this._user = user; + this.bind_property('reactive', this, 'track-hover', + GObject.BindingFlags.SYNC_CREATE); + this.bind_property('reactive', this, 'can-focus', + GObject.BindingFlags.SYNC_CREATE); + // Monitor the scaling factor to make sure we recreate the avatar when needed. this._scaleFactorChangeId = themeContext.connect('notify::scale-factor', this.update.bind(this)); @@ -50,7 +54,6 @@ var Avatar = GObject.registerClass({ } setSensitive(sensitive) { - this.can_focus = sensitive; this.reactive = sensitive; }